package com.joysuch.wwyt.workflow.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

import static javax.persistence.GenerationType.IDENTITY;

@Data
@Entity
@EntityListeners({AutoSetCommonFieldListener.class })
@Table(name = "WWYT_WORKFLOW_BIZ_TYPE")
@SQLDelete(sql = "update WWYT_WORKFLOW_BIZ_TYPE set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update WWYT_WORKFLOW_BIZ_TYPE set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
public class WorkFlowBizType implements Serializable {

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @ApiModelProperty("主键ID")
    private Long id;

    @ApiModelProperty("类型名称")
    private String name;

    @ApiModelProperty("父类型ID")
    private Long parentId;

    @ApiModelProperty("类型关联业务流程ID")
    private Long processId;

    @ApiModelProperty("父类型名称")
    @Transient
    private String parentName;

    @ApiModelProperty("显示顺序")
    private Integer showOrder;

    @ApiModelProperty("状态")
    private Integer state;

    @org.springframework.data.annotation.CreatedBy
    @ApiModelProperty("创建人")
    private Long createBy;

    @org.springframework.data.annotation.CreatedDate
    @ApiModelProperty("创建时间")
    private Date createTime;

    @org.springframework.data.annotation.LastModifiedBy
    @ApiModelProperty("更新人")
    private Long updateBy;

    @org.springframework.data.annotation.LastModifiedDate
    @ApiModelProperty("更新时间")
    private Date updateTime;

    @ApiModelProperty("租户")
    private Long tenentId;

    @ApiModelProperty("组织机构代码")
    private String orgCode;

    @ApiModelProperty("删除标记")
    private String deleteFlag;

}
